import { addNameSpace } from './util'

const NAME_SPACE = 'BATCH_RECORD'

const addPrefix = addNameSpace(NAME_SPACE)

// 设置批次编号
export const SET_BATCH_ID = addPrefix('SET_BATCH_ID')

// 设置短信内容
export const SET_CONTENT = addPrefix('SET_CONTENT')

// 设置审核状态
export const SET_STATUS = addPrefix('SET_STATUS')

// 设置开始时间
export const SET_START_TIME = addPrefix('SET_START_TIME')

// 设置结束时间
export const SET_END_TIME = addPrefix('SET_END_TIME')

// 获取批次记录
export const GET_DATA = addPrefix('GET_DATA')

// 获取批次记录成功
export const GET_DATA_SUCCESS = addPrefix('GET_DATA_SUCCESS')

// 获取批次记录失败
export const GET_DATA_FAIL = addPrefix('GET_DATA_FAIL')

// 设置分页
export const SET_PAGE_NUM = addPrefix('SET_PAGE_NUM')

export const setBatchId = (batchId) => ({ type: SET_BATCH_ID, batchId })

export const setContent = (content) => ({ type: SET_CONTENT, content})

export const setStatus = (status) => ({ type: SET_STATUS, status})

export const setStartTime = (startTime) => ({ type: SET_START_TIME, startTime })

export const setEndTime = (endTime) => ({ type: SET_END_TIME, endTime })

export const getData = () => ({ type: GET_DATA })

export const getDataSuccess = (data) => ({ type: GET_DATA_SUCCESS, data })

export const getDataFail = () => ({ type: GET_DATA_FAIL })

export const setPageNum = (pageNum) => ({ type: SET_PAGE_NUM, pageNum })

export default {
  setBatchId,
  setContent,
  setStatus,
  setStartTime,
  setEndTime,
  getData,
  getDataSuccess,
  getDataFail,
  setPageNum,
}